<?php


namespace app\opengzh\logic;



class ToolLogic {

    public function curl_post($url, $data = '', $timeout = 10)

    {

        if ($url == "" || $timeout <= 0) {
            return false;
        }

        $con = curl_init($url);

        curl_setopt($con, CURLOPT_HEADER, false);

        curl_setopt($con, CURLOPT_RETURNTRANSFER, true);

        curl_setopt($con, CURLOPT_TIMEOUT, (int)$timeout);

        curl_setopt($con, CURLOPT_SSL_VERIFYPEER, false);//调试去掉ssl验证

        // POST数据

        curl_setopt($con, CURLOPT_POST, true);

        // 把post的变量加上

        curl_setopt($con, CURLOPT_POSTFIELDS, $data);

        return curl_exec($con);

    }

}